function doOnLoad(){
  var inputBox = document.getElementById("txtViewpointName");
  inputBox.focus();
}
function doCancel(){
  return true;
}

function doOK(){
  var viewpointName = document.getElementById('txtViewpointName').value;
	var stringBundle = document.getElementById("sbLasuli");
  if('undefined' == typeof viewpointName || viewpointName.trim() == ""){
    alert(stringBundle.getString("viewpointDialog.error.nameisnull"));
    return false;
  }

  var setting = getCurrentSetting();

  var user = setting.hypertopic.username;
  var pass = setting.hypertopic.password;

  var viewpointObject = new Viewpoint();
  viewpointObject.name = viewpointName;
  var_dump("[viewpointDialog.js::doOK] user:", user, 4);
  if(user != ""){
    var actor = {
      "href": setting.hypertopic.url + "actor/" + user + "/",
      "name": user,
      "role": "creator"
      };
    var actorObject = new Actor();
    actorObject.uri = setting.hypertopic.url + "actor/" + user + "/";
    actorObject.name = user;
    var res = actorObject.httpGet(user, pass);

    if(res == false){
      var res = actorObject.httpPut(user, pass);
      if(!res){
        alert(stringBundle.getString("viewpointDialog.error.unableToCreateActor") + user);
        return false;
      }
    }

    var_dump("[viewpointDialog.js::doOK] actor:", actor, 4);

    viewpointObject.actors.push(actor);
  }
  var_dump("[viewpointDialog.js::doOK] viewpointObject:", viewpointObject, 4);
  var res = viewpointObject.httpPost(setting.hypertopic.url + "viewpoint/", user, pass);
  if(res == false){
    alert(stringBundle.getString("viewpointDialog.error.servererror"));
    return false;
  }

  var retVals = window.arguments[0];
  retVals.name  = viewpointName;
  retVals.href = res;
  return true;
}